package com.example.demo.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
public class ResponseResult<T> {
    private int code;
    private String msg;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private T data;

    // 两参数构造函数 (code + msg)
    public ResponseResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    // 三参数构造函数 (code + msg + data)
    public ResponseResult(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}